//
//  NewSecModel.m
//  NeteaseNews
//
//  Created by dllo on 15/11/23.
//  Copyright (c) 2015年 郑举廷. All rights reserved.
//

#import "NewSecModel.h"

@implementation NewSecModel
- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"ads"]) {
        NSArray *arr = value;
        NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
        NSMutableArray *mutalbleTitle = [[NSMutableArray alloc] init];
        for (NSDictionary *dic in arr) {
            [mutableArray addObject:[dic valueForKey:@"imgsrc"]];
            [mutalbleTitle addObject:[dic valueForKey:@"title"]];
           
        }
        self.titleArray = [[NSArray alloc] initWithArray:mutalbleTitle];
        self.ad = [[NSArray alloc] initWithArray:mutableArray];
    }
}

- (id)valueForUndefinedKey:(NSString *)key {
    return nil;
}

- (instancetype)initWithDicitionary:(NSDictionary *)data
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:data];
    }
    return self;
}

@end
